import React, { Component } from 'react'

export default class login extends Component {
  state = {
    username: 'admin',
    password: '123'
  }
  change = e => {
    this.setState({
      [e.target.name]: e.target.value
    })
  }
  render () {
    return (
      <div>
        login
        <p>
          用户名：
          <input
            type='text'
            name='username'
            value={this.state.username}
            onChange={this.change}
          />
        </p>
        <p>
          1 密 码:
          <input
            type='password'
            name='password'
            value={this.state.password}
            onChange={this.change}
          />
        </p>
        <p>
          <button
            onClick={() => {
              console.log(this.state)
            }}
          >
            登录
          </button>
        </p>
      </div>
    )
  }
}
